<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:s="clr-namespace:System;assembly=mscorlib"
                    xmlns:dgCtrl="clr-namespace:VCom.Windows.UiDataGridViewControl;assembly=MAXControls"
                    xmlns:tree="clr-namespace:MAXControls;assembly=MAXControls"
                    xmlns:System="clr-namespace:System;assembly=mscorlib"
                    xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="DataRecordCellAreaBackground">
        <GradientStop Color="#FFFFFFFD" Offset="0"/>
        <GradientStop Color="#FFB3CCE0" Offset="1"/>
        <GradientStop Color="#FFBDE2F7" Offset="0.268"/>
    </LinearGradientBrush>

    <!--<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="BackgroundSelectedBackground">
            <GradientStop Color="#FFFFFFFD" Offset="0"/>
            <GradientStop Color="#FF58B0F7" Offset="1"/>
            <GradientStop Color="#FF8ED2F9" Offset="0.268"/>
        </LinearGradientBrush>-->

    <!--<LinearGradientBrush StartPoint="0,0" EndPoint="0,1" x:Key="BackgroundSelectedBackground">
    <GradientStop Offset="0" Color="#FF18AEE7" />
    <GradientStop Offset="1" Color="#FF03A0DC" />
    <GradientStop Color="#FF0385B6" Offset="0.487"/>
  </LinearGradientBrush>-->

    <SolidColorBrush Color="#CFE2FF"  x:Key="BackgroundSelectedBackground" />

    <!--<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="BorderHoverBrushBackground">
    <GradientStop Color="#FFFFFFFF" Offset="0"/>
    <GradientStop Color="#FFFFD40D" Offset="0.268"/>
  </LinearGradientBrush>-->

    <SolidColorBrush Color="#CFE2FF"  x:Key="BorderHoverBrushBackground" />

    <!--<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="GridViewColumnHeaderBackground">
            <GradientStop Color="#FF039D93" Offset="0.326"/>
            <GradientStop Color="#FF0D8085" Offset="0.382"/>
        </LinearGradientBrush>-->

    <!--<LinearGradientBrush EndPoint="0,1" StartPoint="0,0" x:Key="GridViewColumnHeaderBackground">
    <GradientStop Color="#096DB6" Offset="0"/>
    <GradientStop Color="#3487C3" Offset="0.5"/>
    <GradientStop Color="#096DB6" Offset="0.5"/>
  </LinearGradientBrush>-->
    <SolidColorBrush Color="#3296FA" x:Key="GridViewColumnHeaderBackground" />

    <DockPanel Background="#220000FF" x:Key="DataGridColumnHeaderPanel">
        <Grid DockPanel.Dock="Right"
                                              Margin="0,0,4,0">
            <Path Width="10" Height="8.5" Stretch="Fill" StrokeLineJoin="Round" Stroke="#00FF00E9" Fill="#FFFFFFFF" Data="F1 M 360,191L 352.021,204.82L 367.979,204.82L 360,191 Z "/>
            <Path Width="10" Height="8.5" Stretch="Fill" StrokeLineJoin="Round" Stroke="#00FF00E9" Fill="#FFFFFFFF" Data="F1 M 360,204.82L 367.979,191L 352.021,191L 360,204.82 Z "
                                                Visibility="Collapsed"/>
        </Grid>
    </DockPanel>


    <dgCtrl:ValueConverter x:Key="valueConverter"/>
    <Style TargetType="{x:Type dgCtrl:UiDataGridView}">
        <Style.Resources>
            <Style TargetType="DataGridColumnHeader">
                <Style.Resources>
                    <ResourceDictionary />
                </Style.Resources>
                <Setter Property="Control.VerticalContentAlignment">
                    <Setter.Value>
                        <x:Static Member="VerticalAlignment.Center" />
                    </Setter.Value>
                </Setter>
                <Setter Property="TextElement.Foreground" Value="#FFFFFF"/>
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="DataGridColumnHeader">
                            <Grid>
                                <dgCtrl:UiDataGridHeaderBorder IsHovered="{TemplateBinding UIElement.IsMouseOver}" IsPressed="{TemplateBinding ButtonBase.IsPressed}" IsClickable="{TemplateBinding DataGridColumnHeader.CanUserSort}" SortDirection="{TemplateBinding DataGridColumnHeader.SortDirection}" SeparatorBrush="{TemplateBinding DataGridColumnHeader.SeparatorBrush}" SeparatorVisibility="{TemplateBinding DataGridColumnHeader.SeparatorVisibility}" BorderThickness="{TemplateBinding Border.BorderThickness}" Padding="{TemplateBinding Control.Padding}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{StaticResource GridViewColumnHeaderBackground}"
                                                   Height="29">
                                    <DockPanel Background="#00FFFFFF">
                                        <Grid DockPanel.Dock="Right"
                              Margin="0,0,4,0">
                                            <Path Width="10" Height="8.5" Stretch="Fill" StrokeLineJoin="Round" Stroke="#00FF00E9" Fill="#FFFFFFFF" Data="F1 M 360,191L 352.021,204.82L 367.979,204.82L 360,191 Z "
                                Visibility="Collapsed"/>
                                            <Path Width="10" Height="8.5" Stretch="Fill" StrokeLineJoin="Round" Stroke="#00FF00E9" Fill="#FFFFFFFF" Data="F1 M 360,204.82L 367.979,191L 352.021,191L 360,204.82 Z "
                                Visibility="Collapsed"/>
                                        </Grid>
                                        <ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
                                          HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
                                          ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"  SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                                    </DockPanel>
                                </dgCtrl:UiDataGridHeaderBorder>
                                <Thumb Name="PART_LeftHeaderGripper" HorizontalAlignment="Left">
                                    <Thumb.Style>
                                        <Style TargetType="Thumb">
                                            <Style.Resources>
                                                <ResourceDictionary />
                                            </Style.Resources>
                                            <Setter Property="FrameworkElement.Width">
                                                <Setter.Value>
                                                    <s:Double>8</s:Double>
                                                </Setter.Value>
                                            </Setter>
                                            <Setter Property="Panel.Background">
                                                <Setter.Value>
                                                    <SolidColorBrush>#00FFFFFF</SolidColorBrush>
                                                </Setter.Value>
                                            </Setter>
                                            <Setter Property="FrameworkElement.Cursor">
                                                <Setter.Value>
                                                    <Cursor>SizeWE</Cursor>
                                                </Setter.Value>
                                            </Setter>
                                            <Setter Property="Control.Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="Thumb">
                                                        <Border Padding="{TemplateBinding Control.Padding}" Background="{TemplateBinding Panel.Background}" />
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </Thumb.Style>
                                </Thumb>
                                <Thumb Name="PART_RightHeaderGripper" HorizontalAlignment="Right">
                                    <Thumb.Style>
                                        <Style TargetType="Thumb">
                                            <Style.Resources>
                                                <ResourceDictionary />
                                            </Style.Resources>
                                            <Setter Property="FrameworkElement.Width">
                                                <Setter.Value>
                                                    <s:Double>2</s:Double>
                                                </Setter.Value>
                                            </Setter>
                                            <Setter Property="Panel.Background" Value="White">
                                                <!--<Setter.Value>
                                                        <SolidColorBrush>#00FFFFFF</SolidColorBrush>
                                                    </Setter.Value>-->
                                            </Setter>
                                            <Setter Property="FrameworkElement.Cursor">
                                                <Setter.Value>
                                                    <Cursor>SizeWE</Cursor>
                                                </Setter.Value>
                                            </Setter>
                                            <Setter Property="Control.Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="Thumb">
                                                        <Border Padding="{TemplateBinding Control.Padding}" Background="{TemplateBinding Panel.Background}"
                                        BorderThickness="0,0,1,0"/>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </Thumb.Style>
                                </Thumb>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style TargetType="DataGridRow">
                <Style.Resources>
                    <Style TargetType="DataGridRowHeader">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="DataGridRowHeader">
                                    <Grid Visibility="Collapsed">
                                        <CheckBox IsChecked="{Binding RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type DataGridRow}, Mode=FindAncestor}, Path=Item, Converter={StaticResource valueConverter}}"/>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Style.Resources>
                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Background" Value="{StaticResource BorderHoverBrushBackground}"/>
                    </Trigger>
                    <Trigger Property="IsSelected" Value="True">
                        <Setter Property="Background" Value="{StaticResource BackgroundSelectedBackground}"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
            <Style TargetType="DataGridCell">
                <Setter Property="VerticalAlignment" Value="Center" />
                <!--<Setter Property="Margin" Value="-1,0,1,0"></Setter>
                <Setter Property="BorderBrush" Value="#FFE7E7E7"></Setter>
                <Setter Property="BorderThickness" Value="0, 0, 1, 1"></Setter>-->
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                <Setter Property="Height" Value="30" />
                <Style.Triggers>
                    <Trigger Property="IsSelected" Value="True">
                        <Setter Property="Background" Value="Transparent"/>
                        <Setter Property="BorderBrush" Value="Transparent"/>
                        <Setter Property="TextElement.Foreground" Value="#333333" />
                    </Trigger>
                    <Trigger Property="IsFocused" Value="True">
                        <Setter Property="Background" Value="Transparent"/>
                        <Setter Property="BorderBrush" Value="Transparent"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
            <!--<Style TargetType="{x:Type dgCtrl:UiDataGridHeaderBorder}">

            </Style>-->
        </Style.Resources>
        <Setter Property="Panel.Background">
            <Setter.Value>
                <DynamicResource ResourceKey="{x:Static SystemColors.WindowBrushKey}" />
            </Setter.Value>
        </Setter>
        <!--<Setter Property="TextElement.Foreground">
                <Setter.Value>
                    <DynamicResource ResourceKey="{x:Static SystemColors.ControlTextBrushKey}" />
                </Setter.Value>
            </Setter>-->
        <Setter Property="Border.BorderBrush">
            <Setter.Value>
                <SolidColorBrush>#FF688CAF</SolidColorBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Border.BorderThickness">
            <Setter.Value>
                <Thickness>1,1,1,1</Thickness>
            </Setter.Value>
        </Setter>
        <Setter Property="GridLinesVisibility" Value="All"/>
        <Setter Property="HorizontalGridLinesBrush" Value="#FFE7E7E7"/>
        <Setter Property="VerticalGridLinesBrush" Value="#FFE7E7E7"/>
        <Setter Property="AlternatingRowBackground" Value="#F5F7FA"/>
        <Setter Property="CanUserAddRows" Value="False"/>
        <Setter Property="CanUserDeleteRows" Value="False"/>
        <Setter Property="IsReadOnly" Value="True"/>


        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type dgCtrl:UiDataGridView}">
                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}" Padding="{TemplateBinding Control.Padding}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}" SnapsToDevicePixels="True">
                        <ScrollViewer Name="DG_ScrollViewer" Focusable="False">
                            <ScrollViewer.Template>
                                <ControlTemplate TargetType="ScrollViewer">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="Auto" />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <Button Command="SelectAll" Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=DataGrid, ResourceId=DataGridSelectAllButtonStyle}}" Width="Auto" Visibility="Collapsed" Focusable="False" />
                                        <DataGridColumnHeadersPresenter Name="PART_ColumnHeadersPresenter" Visibility="Visible" Grid.Column="1" />
                                        <ScrollContentPresenter CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" Name="PART_ScrollContentPresenter" Grid.Row="1" Grid.ColumnSpan="2" />
                                        <ScrollBar  x:Name="PART_VerticalScrollBar" Grid.Column="2" Maximum="{TemplateBinding ScrollableHeight}" Orientation="Vertical" Grid.RowSpan="2" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
                                        <Grid Grid.Column="1" Grid.Row="2">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="{Binding NonFrozenColumnsViewportHorizontalOffset, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            <ScrollBar x:Name="PART_HorizontalScrollBar" Grid.Column="1" Maximum="{TemplateBinding ScrollableWidth}" Orientation="Horizontal" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
                                        </Grid>
                                    </Grid>
                                </ControlTemplate>
                            </ScrollViewer.Template>
                            <ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="GridViewColumnHeader">
        <Style.Resources>
            <ResourceDictionary />
        </Style.Resources>
        <Setter Property="Control.VerticalContentAlignment">
            <Setter.Value>
                <x:Static Member="VerticalAlignment.Center" />
            </Setter.Value>
        </Setter>
        <Setter Property="Control.HorizontalContentAlignment">
            <Setter.Value>
                <x:Static Member="HorizontalAlignment.Left" />
            </Setter.Value>
        </Setter>
        <Setter Property="TextElement.Foreground" Value="#FFFFFF"/>
        <Setter Property="TextElement.FontSize" Value="14" />
        <Setter Property="Margin" Value="-2,-1,0,0" />
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate TargetType="GridViewColumnHeader">
                    <Grid Name="g" Background="{StaticResource GridViewColumnHeaderBackground}">
                        <Border BorderThickness="0,0,1,0" BorderBrush="#EBEEF4" Background="{StaticResource GridViewColumnHeaderBackground}"
                                                       Height="29">
                            <DockPanel Background="#00FFFFFF">
                                <Grid DockPanel.Dock="Right"
                                  Margin="0,0,4,0">
                                    <Path Width="10" Height="8.5" Stretch="Fill" StrokeLineJoin="Round" Stroke="#00FF00E9" Fill="#FFFFFFFF" Data="F1 M 360,191L 352.021,204.82L 367.979,204.82L 360,191 Z "
                                    Visibility="Collapsed"/>
                                    <Path Width="10" Height="8.5" Stretch="Fill" StrokeLineJoin="Round" Stroke="#00FF00E9" Fill="#FFFFFFFF" Data="F1 M 360,204.82L 367.979,191L 352.021,191L 360,204.82 Z "
                                    Visibility="Collapsed"/>
                                </Grid>
                                <ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" Margin="8,0,0,0"
                                              HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
                                              ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"  SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
                            </DockPanel>
                        </Border>
                        <Thumb Name="PART_LeftHeaderGripper" HorizontalAlignment="Left">
                            <Thumb.Style>
                                <Style TargetType="Thumb">
                                    <Style.Resources>
                                        <ResourceDictionary />
                                    </Style.Resources>
                                    <Setter Property="FrameworkElement.Width">
                                        <Setter.Value>
                                            <s:Double>8</s:Double>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Panel.Background" Value="{StaticResource GridViewColumnHeaderBackground}">
                                    </Setter>
                                    <Setter Property="Control.Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="Thumb">
                                                <Border Padding="{TemplateBinding Control.Padding}" Background="{TemplateBinding Panel.Background}" />
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Thumb.Style>
                        </Thumb>
                        <Thumb Name="PART_RightHeaderGripper" HorizontalAlignment="Right">
                            <Thumb.Style>
                                <Style TargetType="Thumb">
                                    <Style.Resources>
                                        <ResourceDictionary />
                                    </Style.Resources>
                                    <Setter Property="FrameworkElement.Width">
                                        <Setter.Value>
                                            <s:Double>2</s:Double>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Panel.Background"  Value="{StaticResource GridViewColumnHeaderBackground}">
                                    </Setter>
                                    <Setter Property="Control.Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="Thumb">
                                                <Border Padding="{TemplateBinding Control.Padding}" Background="{TemplateBinding Panel.Background}"
                                            BorderThickness="0,0,1,0"/>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Thumb.Style>
                        </Thumb>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <tree:ListViewItemBackgroundConverter x:Key="s_ListViewItemBackgroundConverter" />

    <Style TargetType="{x:Type ListViewItem}" x:Key="listViewItemStyle">
        <Style.Setters>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="TextElement.Foreground" Value="#333333"/>
            <Setter Property="TextElement.FontSize" Value="14" />
            <Setter Property="Height" Value="30" />
            <Setter Property="Background">
                <Setter.Value>
                    <Binding RelativeSource="{RelativeSource Self}" Converter="{StaticResource s_ListViewItemBackgroundConverter}" />
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListViewItem}">
                        <Border BorderThickness="0"
                    Background="{TemplateBinding Background}">
                            <Border BorderThickness="0"
                      BorderBrush="#EBEEF4"
                      Background="{TemplateBinding Background}"
                      Margin="0">
                                <Grid>
                                    <GridViewRowPresenter/>
                                </Grid>
                            </Border>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style.Setters>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource BorderHoverBrushBackground}"/>
            </Trigger>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="{StaticResource BackgroundSelectedBackground}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource listViewItemStyle}">
        
    </Style>

        <Style TargetType="{x:Type tree:TreeListItem}" x:Key="treeListItemStyle">
        <Style.Setters>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="TextElement.Foreground" Value="#333333"/>
            <Setter Property="TextElement.FontSize" Value="14" />
            <Setter Property="Height" Value="30" />
            <Setter Property="Background">
                <Setter.Value>
                    <Binding RelativeSource="{RelativeSource Self}" Converter="{StaticResource s_ListViewItemBackgroundConverter}" />
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type tree:TreeListItem}">
                        <Border BorderThickness="0"
                    Background="{TemplateBinding Background}">
                            <Border BorderThickness="1"
                      BorderBrush="#EBEEF4"
                      Background="{TemplateBinding Background}"
                      Margin="0,-1">
                                <Grid>
                                    <GridViewRowPresenter/>
                                </Grid>
                            </Border>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style.Setters>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{StaticResource BorderHoverBrushBackground}"/>
            </Trigger>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="{StaticResource BackgroundSelectedBackground}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type tree:TreeListItem}" BasedOn="{StaticResource treeListItemStyle}">
        
    </Style>

</ResourceDictionary>